#!/usr/bin/env node

const program = require('commander')
const scrape = require('./scrape')
const list = require('./list')
const changed = require('./changed')
const search = require('./search')

program
  .version('0.0.1')
  .description('shanbay books cmd tool.')

program
  .command('scrape')
  .description('scrape from web.')
  .action(() => scrape())

program
  .command('list')
  .description('list books.')
  .action(() => list())

program
  .command('changed')
  .description('list changed price books.')
  .action(() => changed())

program
  .command('search').alias('s')
  .description('search books.')
  .option('-a, --author <author>', 'search by author')
  .option('-t, --title <title>', 'search by title')
  .option('-g, --tags <tags>', 'search by tags')
  .option('-o, --order <order>', 'sort order')
  .option('-s, --sort <sort>', 'sort field')
  .action(search)

program.parse(process.argv)
